<template>
	<view class="mix-product-list is-row">
		<view 
			class="list-item row b-b" 
			v-if="listType === 'pro'" 
			v-for="item in list" 
			:key="item.id"
		>
			<view class="image-wrapper">
				<image :src="item.imglist[0]" mode="aspectFill"></image>
			</view>
			<view class="right column">
				<text class="title clamp">{{ item.name }}</text>
				<text class="sales">月销 {{ item.num }}</text>
				<view class="price-wrap row">
					<view class="mix-price-view">
						<text>￥</text>
						<text class="price">{{ item.price }}</text>
					</view>

					<text class="m-price">￥{{ item.money }}</text>
					<view class="tags row">
						<view class="tag center">
							<text>包邮</text>
						</view>
						<view class="tag center orange">
							<text>赠{{ item.integral}}积分</text>
						</view>
					</view>
				</view>
			</view>
		</view>


	</view>
</template>

<script>
	export default {
		name: 'getprolist',
		data() {
			return {
				loadType: '',
			};
		},
		props: {
			list: {
				type: Array,
				default () {
					return []
				}
			},
			listType: {
				type: String,
				default: 'column'
			}
		},
		watch: {

		},
		methods: {

		}
	}
</script>

<style scoped lang="scss">
	.mix-price-view {
		color: $base-color;
	}

	.price {
		font-weight: 700;
	}

	.mix-product-list {
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
		width: 98%;
		margin: 0 1% 0 1%;
		background-color: #f7f7f7;

		&.is-row {
			margin-top: -1vw;
			border-radius: 1vw;
			box-shadow: 1vw 1vw 2vw rgba(0, 0, 0, .06);
			overflow: hidden;
		}
	}

	/* 横向列表 */
	.list-item.row {
		width: 100%;
		padding: 1vw 0 2vw 2vw;
		background-color: #fff;

		&:after {
			border-color: #eaeaea;
			left: 1vw;
			right: 1vw;
		}

		&:last-child:after {
			border: 0;
		}

		.image-wrapper {
			flex-shrink: 0;
			width: 21%;
			height: 20vw;
			margin-right: 2vw;
			border-radius: 1vw;
			overflow: hidden;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.right {
			flex: 1;
			overflow: hidden;
		}

		.title {
			margin-right: 2vw;
			font-size: 3.5vw;
			color: #333;
			line-height: 4vw;
		}

		.sales {
			height: 5vw;
			margin: 1vw 0 2vw;
			line-height: 5vw;
			font-size: 2.5vw;
			color: #888;
		}

		.price-wrap {
			display: flex;
			align-items: baseline;
			padding-right: 3vw;
			font-size: 4vw;;
		}

		.m-price {
			font-size: 2vw;
			text-decoration: line-through;
			color: #999;
			margin-left: 2%;
		}

		.tags {
			flex: 1;
			justify-content: flex-end;
			position: relative;
			bottom: 0vw;
		}

		.tag {
			height: 4.5vw;
			padding: 0 1vw;
			margin-left: 2vw;
			font-size: 3vw;
			color: #fff;
			border-radius: 1vw;
			background-color: $base-color;

			&.orange {
				background-color: orange;
			}
		}
	}

	/* 竖向列表 */
	.list-item.column {
		width: 350rpx;
		padding-bottom: 16rpx;
		margin-bottom: 12rpx;
		background: #fff;
		border-radius: 8rpx;
		overflow: hidden;
		box-shadow: 0 0 16rpx rgba(0, 0, 0, .06);
		position: relative;

		.image-wrapper {
			width: 100%;
			height: 350rpx;
			overflow: hidden;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.title {
			font-size: 28rpx;
			color: #333;
			line-height: 36rpx;
			padding: 0 16rpx;
			margin-top: 18rpx;
			height: 76rpx;
		}

		.price-wrap {
			padding: 0 16rpx;
			margin-top: 18rpx;
		}

		.m-price {
			font-size: 24rpx;
			text-decoration: line-through;
			color: #999;
			margin-left: 10rpx;

			&:before {
				content: "￥";
			}
		}

		.tag {
			height: 32rpx;
			padding: 0 10rpx;
			font-size: 20rpx;
			background-color: $base-color;
			color: #fff;
			border-radius: 4rpx;
			transform: translateY(-4rpx);
		}
	}
</style>
